home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 1996 April / Software of the Month Club 1996 April.iso / pc / os2 / psutils / cmd / fixwpps.cmd < prev    next >
Encoding:
Text File  |  1996-02-21  |  731 b   |  34 lines

  1. extproc perl5 -x
  2. #! perl5
  3.  
  4. # fixwpps: get semi-conforming PostScript out of WordPerfect 5.0 file
  5. #
  6. # Copyright (C) Angus J. C. Duggan 1991-1995
  7. # See file LICENSE for details.
  8.  
  9. $page = 1;
  10. $nesting = 0;
  11.  
  12. while (<>) {
  13.    s/([^\/]_t)([0-9]+)/\1 \2/g;    # fix wp 5.0 bug
  14.    if (m!/_[be][dp]! || m!_bp \d+ \d+ roll!) {
  15.       print $_;
  16.    } elsif (/^(.*)(_bp.*)$/) {
  17.       print "$1\n" if $1 ne "";
  18.       print "%%Page: $page $page\n";
  19.       print "$2\n";
  20.       $page++;
  21.       $nesting++;
  22.    } elsif (/_ep$/) {
  23.       print $_;
  24.       $nesting--;
  25.    } elsif (/^(.*)(_ed.*)/) {
  26.       print "$1\n" if $1 ne "";
  27.       print "%%Trailer:\n";
  28.       print "$2\n";
  29.    } else {
  30.       print $_;
  31.    }
  32. }
  33. # End of Script
  34.